package net.recursv.motific.atweaver

/**
 * Created by IntelliJ IDEA.
 * User: recursv
 * Date: 27/08/2009
 * Time: 3:48:08 PM
 * To change this template use File | Settings | File Templates.
 */
class FileParserTest extends GroovyTestCase {
  public void testResource() {
    def orig = new File("at weaver/test-res/original.java").text;
    def gen = new File("at weaver/test-res/gen.java").text;

    assertEquals(stripWhiteSpace(gen), stripWhiteSpace(new FileParser().transform(orig)))
  }

  String stripWhiteSpace(String s) {
    return s.replaceAll(/[\r\t\n]/, "").replaceAll(/ {4}/, "").replaceAll(/([;{}])/, {a, b -> b + "\n"});
  }
}
